<?php

namespace common\models\shop;

use Yii;

/**
 * This is the model class for table "shop_farmhouse".
 *
 * @property string $id
 * @property integer $personid
 * @property string $name
 * @property integer $farmerid
 * @property string $envdesc
 * @property string $accommodation
 * @property integer $roomnum
 * @property integer $canfeed
 * @property integer $caninnum
 * @property string $price
 * @property string $envphoto
 * @property string $accommodationphoto
 * @property integer $createtime
 */
class ShopFarmhouse extends \yii\db\ActiveRecord
{

    //主要用于日志记录
    public $uselog = [
        'tabcomment' => '农家乐',      //用于修改了什么的显示
        'mainfield' => 'name',      //主要的显示标题的字段
        'picturefield' => ['envphoto','accommodationphoto'],        //图片字段
        'timefield' => [],       //时间字段
        'unsetfiled' =>[],      //不需要记录的字段
    ];


    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'shop_farmhouse';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['personid', 'name', 'farmerid', 'envdesc', 'accommodation', 'roomnum', 'canfeed', 'caninnum', 'price', 'envphoto', 'accommodationphoto', 'createtime'], 'required'],
            [['personid', 'farmerid', 'roomnum', 'canfeed', 'caninnum', 'createtime'], 'integer'],
            [['price'], 'number'],
            [['name'], 'string', 'max' => 255],
            [['envdesc', 'accommodation'], 'string', 'max' => 2000],
            [['envphoto', 'accommodationphoto'], 'string', 'max' => 1000],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'personid' => 'Personid',
            'name' => 'Name',
            'farmerid' => 'Farmerid',
            'envdesc' => 'Envdesc',
            'accommodation' => 'Accommodation',
            'roomnum' => 'Roomnum',
            'canfeed' => 'Canfeed',
            'caninnum' => 'Caninnum',
            'price' => 'Price',
            'envphoto' => 'Envphoto',
            'accommodationphoto' => 'Accommodationphoto',
            'createtime' => 'Createtime',
        ];
    }
}
